package com.tadpole.music.adapter.me;

import android.app.Activity;
import android.view.LayoutInflater;
import android.view.ViewGroup;

import androidx.annotation.NonNull;

import com.tadpole.music.R;
import com.tadpole.music.adapter.base.BaseAdapter;
import com.tadpole.music.bean.me.MoNiErrorBean;
import com.tadpole.music.holder.base.BaseViewHolder;

import com.tadpole.music.holder.me.WorkV2ViewHolder;


/**
 *
 * Created By 孙岩
 * on 2020/12/26
 */
public class WorkV2Adapter extends BaseAdapter {
    private Activity activity;
    private WorkV2ViewHolder workV2ViewHolder;
    private OnItemClickListener onItemClickListener;
    private MoNiErrorBean.DataBean bean;

    public WorkV2Adapter(Activity activity,MoNiErrorBean.DataBean bean){
        this.activity = activity;
        this.bean = bean;
    }

    @Override
    public BaseViewHolder createRelHolder(ViewGroup parent, int viewType) {

        workV2ViewHolder = new WorkV2ViewHolder(activity, LayoutInflater.from(activity).inflate(R.layout.item_v2_work, parent, false),onItemClickListener,bean);
        return workV2ViewHolder;
    }

    @Override
    public int getRelItemCount() {
        return bean.getMonth_class_static().size();
    }

    @Override
    public void setOnItemClickListener(OnItemClickListener listener) {
        this.onItemClickListener = listener;
    }

    @Override
    public void setOnChildClickListener(OnChildClickListener listener) {

    }

    @Override
    public void setOnLongClickListener(OnLongClickListener listener) {

    }

    @Override
    public void onBindViewHolder(@NonNull BaseViewHolder holder, int position) {
        holder.init(position - mHeadViews.size());
    }
}
